Lcc-win32 offers a series of
pseudo-functions that use the call syntax function, but which will trigger the
emission of an inlined assembly macro. These macros do not have the overhead of
the function call instruction and spare the cost of setting up and destroying a
procedure frame. They can be used only if the file « intrinsics.h »
is present in the compilation unit.
Name |
Description
|
long long _rdtsc(void) |
Returns a long long integer (64
bits) containing the number of cycles that the machine has done since it was
turned on. Since this counter is automatically incremented at each
cycle, to get a time in seconds you
have to divide by the clock speed of your machine. For example if you divide
the value by 166 x 1e6 you get the number of seconds elapsed for a 166 MHz
machine. This intrinsic value will use up some cycles for converting the 64
bit value into a floating point number, so there will be an overhead of at
most 1000 cycles: at 200 MHz this should be 5 millionths of a second. |
int _bswap(long) |
Returns the byte swapped long
integer. |
double _fsicncos(arg,cos *) |
Returns sin(arg), and stores
the cosine in the address pointed by cos *. |
double _fcos(double) |
Returns the cosinus of its
argument. |
double _fsin(double) |
Returns the sinus of its
argument. |
double _fldpi(void) |
Returns the constant pi in
floating point format. |
double _fldl2e(void) |
Returns the logarithm base 2 of
e. |
double _fldlg2(void) |
Returns the logarithm base 10
of e. |
double _fldln2(void) |
Returns the natural logarithm
(base e) of 2. |
int _carry(void) |
Returns the carry flag as an
integer. This value is VERY volatile, since most calculations set/unset it.
You should not assume that the value returned is the value of the last C
instruction performed, since the lcc’s optimizer could re-arrange the
instructions. The best way to do this is to write only one operation,
immediately followed by an assignment expression. For example you should
write: a = b+c; instead of a = b+foo(5)+78; If you test the carry/overflow
flag at the end of a complicated expression, you cannot know the exact
operation that produced the error. Besides, since many operations change this
flag, an actual overflow could be hidden by the operations that follow it. |
int _fistp(arg) |
Returns a long integer from the
given double using the rounding mode that is in effect at the time of the
call. Normally this should be rounding to nearest number, since lcc-win32
never changes this setting. This allows for very fast rounding. Remember that
to satisfy the rules of ANSI C, lcc-win32 is forced to set the rounding to
truncation, round the figure, and then restore the original mode. This can be
avoided by using this intrinsic function to round floating point data. |
int _overflow(void) |
Returns the value of the
overflow flag. The same considerations apply as to the carry() function
above. |
int rint(double) |
Rounds the given floating point
number to an integer using the current rounding mode. By default, the
rounding mode is round to nearest number. To use this, you should include
<math.h>. |
int _bsr(long) |
Returns an integer with the
index of the first non-zero bit in the given integer, starting with the most
significant bit. |
int _bsf(long) |
Returns an integer with the
index of the first non-zero bit in the given integer starting with the least
significant bit. |
Lcc-win32 offers special macros
for all MMX instructions. Please refer to the associated documentation.